//
//  InvestFirstCell.m
//  TenThousand
//
//  Created by baixue on 16/6/6.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "InvestFirstCell.h"

@implementation InvestFirstCell
{
    NSString *show;
    UILabel *labe;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    CGFloat width = 70;
    _pieChartView = [[PieProgressBar alloc]initWithFrame:CGRectMake(Screen_Width -100, 40, width, width)];
    
    [self.contentView addSubview:_pieChartView];
}


- (void)setDataWithModel:(TransferGetListModel *)model{
    _PrjectName.text = [NSString stringWithFormat:@"%@%@",model.PrjectName,model.Code];
    ;
    
    NSArray *arr = [model.AddDate componentsSeparatedByString:@" "];
    
    _AddDate.text = [NSString stringWithFormat:@"%@",arr[0]];
    
    NSString *string = @"100";
    [_pieChartView updatePercent:[string floatValue] animation:YES];
    
    
    _Rate.text = [NSString stringWithFormat:@"%.2f%%",model.Rate];

    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.Rate.text];
    //设置字号
    [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20.0f] range:NSMakeRange(self.Rate.text.length-3, 3)];
    self.Rate.attributedText = str;
    

    _Ammount.text = [NSString stringWithFormat:@"%.2f元",[model.Ammount floatValue] ];
    NSMutableAttributedString *strA = [[NSMutableAttributedString alloc] initWithString:self.Ammount.text];
    //设置字号
    [strA addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15.0f] range:NSMakeRange(self.Ammount.text.length-3, 3)];
    self.Ammount.attributedText = strA;
    self.stateLabel.text = [NSString stringWithFormat:@"%@", model.State];
    
}

- (void)setDataSourceWithModel:(BorrowListModel *)model{
    _PrjectName.text = [NSString stringWithFormat:@"%@%@",model.PrjectName,model.Code];
    ;
    
    NSArray *arr = [model.AddDate componentsSeparatedByString:@" "];
    
    _AddDate.text = [NSString stringWithFormat:@"%@",arr[0]];
    
    NSString *string = @"100";
    [_pieChartView updatePercent:[string floatValue] animation:YES];
    
    
    _Rate.text = [NSString stringWithFormat:@"%.2f%%",model.Rate ];
    
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.Rate.text];
    //设置字号
    [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20.0f] range:NSMakeRange(self.Rate.text.length-3, 3)];
    self.Rate.attributedText = str;
    
    
    _Ammount.text = [NSString stringWithFormat:@"%.2f元",[model.Ammount floatValue] ];
    NSMutableAttributedString *strA = [[NSMutableAttributedString alloc] initWithString:self.Ammount.text];
    //设置字号
    [strA addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15.0f] range:NSMakeRange(self.Ammount.text.length-3, 3)];
    self.Ammount.attributedText = strA;
    
    _stateLabel.text = [NSString stringWithFormat:@"%@",model.State];
    
    
}

-(void)drawRect:(CGRect)rect{
    //cell添加阴影
    _backLab.layer.shadowColor = [UIColor colorWithRed:0.85 green:0.85 blue:0.85 alpha:1.00].CGColor;
    _backLab.layer.shadowOffset =CGSizeMake(0, 1);;
    _backLab.layer.shadowOpacity = YES;
}

@end
